package com.cyou.dream.core;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 风控配置管理器
 * <p>
 * 自动每一分钟检查一次配置文件变动并重载
 */
@Component
public class RiskConfigManager {

    private final IRiskEngine riskEngine;

    public RiskConfigManager(IRiskEngine riskEngine) {
        this.riskEngine = riskEngine;
    }

    @Scheduled(cron = "0 */1 * * * ?")
    private void reloadRiskConfig() {
        riskEngine.reloadConfig();
    }
}
